import request from '@/config/axios'
/* 知识体系管理 */

export interface tarsm {
  id: string
  pageNo: string
  pageSize: string
  name: string
  code: string
  pid: string
  remark: string
  hierarchyId?: Number
}
//知识体系添加接口封装
// export const reqAddOrUpdateAttr = async (data: Attr) => {
//   return await request.post({
//     // url: '/hierarchy/add',
//     url: `/hierarchy/add?id=${data.id}&name=${data.name}&code=${data.code}&pid=${data.pid}&remark=${data.remark}`,
//     // data:data
//   })
// }
//知识体系删除接口封装
export const remove = async (id: string) => {
  return await request.delete({
    url: `/hierarchy/delete?id=${id}`
  })
}
//知识查询接口封装
export const inquiry = async (data: Attr) => {
  return await request.get({
    // url:`/hierarchy/page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
    url: `/hierarchy/listParent`,
    data: data
  })
}
//知识编辑接口封装
export const editor = async (data: any) => {
  if (data.id) {
    // admin-api/hierarchy/add
    return await request.post({
      url: '/hierarchy/update',
      data: data
    })
  } else {
    return await request.post({
      // url: '/hierarchy/add',
      url: `/hierarchy/add?name=${data.name}&code=${data.code}&pid=${data.pid}&remark=${data.remark}`,
    })
  }
}
//知识完成接口封装
// export const done = async (data: Attr) => {

// }
//多级选择接口
export const Multiselection = async (data: any) => {
  return await request.get({ url: `/hierarchy/list`, data: data })
}

//完成添加
export const Deaturs = async (hierarchyId: any, data: any) => {
  return request.post({
    url: `/point/add?hierarchyId=${hierarchyId}`,
    data: data
  })
}
//完成添加后表格接口
export const tablist = async (id:Number) => {
  return request.get({url:`/point/list?id=${id}`});
}
